package application.view 
{
	import application.ApplicationFacade;
	import application.view.viewComponent.SelectGroupController;
	import ginger.events.DataEvent;
	import org.puremvc.as3.interfaces.IMediator;
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;
	
	/**
	 * ...
	 * @author Ning
	 */
	public class ChooseGroupControllerMediator extends Mediator implements IMediator
	{
		public static const NAME:String = 'ChooseGroupControllerMediator';
		public function ChooseGroupControllerMediator(viewComponent:SelectGroupController) 
		{
			super(NAME, viewComponent);
			selectGroupController.addEventListener(SelectGroupController.SELECT, onSelect);
		}
		private function get selectGroupController():SelectGroupController {
			return viewComponent as SelectGroupController;
		}
		override public function handleNotification(notification:INotification):void 
		{
			switch(notification.getName())
			{
				case ApplicationFacade.UPDATE_CONFIG:
				selectGroupController.setup();
				break;
			}
		}
		override public function listNotificationInterests():Array 
		{
			return [ApplicationFacade.UPDATE_CONFIG];
		}
		
		//选择
		private function onSelect(evt:DataEvent):void
		{
			sendNotification(ApplicationFacade.SELECT_PIC_GROUP, evt.data);
		}
	}
}